fix(core): fix broken error handling in getManifestJson#3556
Conversation
Failures in loading the manifest file does not return the actual error, but a useless function reference to plugins. Error handling is not possible. The "err" variable is now passed in as "error".
|
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
@2heal1 @ScriptedAlchemy could this get merged to allow error handling in a proper way? :-) |
|
@foxylion thanks for fixing this! Do you have any example(s) of how to handle this error? |
|
@koen-dev You'll need to implement a module federation plugin. An example could be: import type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';
const logger = getLogger('module-federation/error-handling-plugin');
export const errorHandlingPlugin = (): FederationRuntimePlugin => {
return {
name: 'error-handling-plugin',
errorLoadRemote(args) {
// In the future, we'll need to filter down for real errors, but we need to figure out what is a real error and what not
logger.captureException(args.error, { info: 'tracked by module-federation/error-handling-plugin/errorLoadRemote' });
return args;
},
};
};Then register it either and build-time (using In our case we are forwarding the errors to Sentry. Some of them will be supressed (e.g. network fetch errors, others might need triage). |
Description
Failures in loading the manifest file does not return the actual error, but a useless function reference to plugins. Error handling is not possible. The "err" variable is now passed in as "error".
Related Issue
No issue yet created.
Types of changes
Checklist